<div class="box">
    <div class="box-header">
        <h3 class="box-title">Report template management</h3>
    </div>
    <div class="box-body">
        <div class="row mb-s">
            <div class="col-md-12 clearfix">
                <div class="pull-left">
                    <!-- Single button -->
                    <div class="btn-group">
                        <button type="button" class="btn btn-sm btn-primary" ng-click="vm.import()">
                            <span class="fa fa-upload"></span> Import templates
                        </button>
                    </div>
                </div>
            </div>
        </div>
        <div class="row mv-s" ng-show="vm.analyzerCount === 0">
            <div class="col-md-12">
                <div class="empty-message">No report templates found.</div>
            </div>
        </div>
        <div class="row" ng-show="vm.analyzerCount > 0">
            <div class="col-md-12">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th width="200px">Short template</th>
                            <th width="200px">Long template</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="analyzerId in vm.analyzerIds | orderBy:'toString()'" ng-init="analyzer=vm.analyzers[analyzerId]">
                            <td>
                                {{::vm.analyzers[analyzerId].name || vm.analyzers[analyzerId].id}}<br>
                                <small class="text-muted">{{::vm.analyzers[analyzerId].description}}</small>
                            </td>
                            <td class="vmiddle">
                                <div class="btn-group btn-group-sm" ng-if="vm.analyzers[analyzerId].shortReport">
                                    <button type="button" class="btn btn-default" ng-click="vm.showTemplate(vm.analyzers[analyzerId].shortReport, analyzer)">View Template</button>
                                    <button type="button" class="btn btn-danger" ng-click="vm.deleteTemplate(vm.analyzers[analyzerId].shortReport)"><i class="fa fa-times"></i></button>
                                </div>
                                <div class="btn-group btn-group-sm" ng-if="!vm.analyzers[analyzerId].shortReport">
                                    <button type="button" class="btn btn-default" ng-click="vm.showTemplate({reportType: 'short'}, analyzer)">Default template</button>
                                </div>
                            </td>
                            <td class="vmiddle">
                                <div class="btn-group btn-group-sm" ng-if="vm.analyzers[analyzerId].longReport">
                                    <button type="button" class="btn btn-default" ng-click="vm.showTemplate(vm.analyzers[analyzerId].longReport, analyzer)">View Template</button>
                                    <button type="button" class="btn btn-danger" ng-click="vm.deleteTemplate(vm.analyzers[analyzerId].longReport)"><i class="fa fa-times"></i></button>
                                </div>
                                <div class="btn-group btn-group-sm" ng-if="!vm.analyzers[analyzerId].longReport">
                                    <button type="button" class="btn btn-default" ng-click="vm.showTemplate({reportType: 'long'}, analyzer)">Default template</button>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

    </div>
</div>
